package com.gimi.cloud.jimi.dto.params;

import java.util.HashMap;
import java.util.Map;

public class InterfaceCenterParams {

    private RequestHead head;
    private Map<String, Object> body;

    public InterfaceCenterParams(String serviceName, String apiname) {
        head = new RequestHead(serviceName, apiname);
        body = new HashMap<>();
    }

    public InterfaceCenterParams() {
        head = new RequestHead();
        body = new HashMap<>();
    }

    public void setServiceName(String serviceName) {
        head.setServiceName(serviceName);
    }

    public void setApiname(String apiname) {
        head.setApiname(apiname);
    }

    public void addParam(String name, String value){
        body.put(name, value);
    }

    public void addParams(Map<String, Object> params) {
        body.putAll(params);
    }

    public class RequestHead {
        private String serviceName;
        private String apiname;

        public RequestHead(){}

        public RequestHead(String serviceName, String apiname) {
            this.serviceName = serviceName;
            this.apiname = apiname;
        }

        public String getServiceName() {
            return serviceName;
        }

        public void setServiceName(String serviceName) {
            this.serviceName = serviceName;
        }

        public String getApiname() {
            return apiname;
        }

        public void setApiname(String apiname) {
            this.apiname = apiname;
        }
    }

    public void setHead(RequestHead head) {
        this.head = head;
    }

    public RequestHead getHead() {
        return head;
    }

    public Map<String, Object> getBody() {
        return body;
    }
}
